/* 
类与继承
*/
class Animal {
    // 静态方法
    static showInfo() {
            console.log("hi");
        }
        //  构造器
    constructor(name) {
        this.name = name;
    }
    showName() {
        console.log(this.name);
    }
}
let a = new Animal('小潘');
a.showName();
// 静态方法必须要用构造函数名来调用
Animal.showInfo();

class Dog extends Animal {
    constructor(name, color) {
        super(name); // super用来调用父类
        this.color = color;
    }

    showColor() {
        console.log(this.color);
    }
}
let d = new Dog('多多', 'red');
d.showName();
d.showColor();
Dog.showInfo();